﻿
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Add</title>
    <link href="~/Content/layui/css/layui.css" rel="stylesheet" />
</head>
<body>
    <div>
        <form class="layui-form" action="">
            <input type="hidden" name="Id" id="realId" value="@Model.Id" />
            <div class="layui-form-item">
                <label class="layui-form-label">模块名</label>
                <div class="layui-input-block">
                    <input type="text" name="ModuleName" id="ModuleName" required lay-verify="required" placeholder="请输入歌曲名" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">控制器名</label>
                <div class="layui-input-block">
                    <input type="text" name="ControllerName" id="ControllerName" required lay-verify="required" placeholder="请输入歌曲名" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">动作方法名</label>
                <div class="layui-input-block">
                    <input type="text" name="ActionName" id="ActionName" required lay-verify="required" placeholder="请输入专辑" autocomplete="off" class="layui-input">
                </div>
            </div>
            <input type="hidden" name="ParentId" id="ParentId" value="@Model.Id" required lay-verify="required" placeholder="请输入歌手" autocomplete="off" class="layui-input">
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </form>
    </div>
    <script src="~/Content/layui/layui.js"></script>
    <script>
        //Demo
        layui.use('form', function () {
            var form = layui.form;
            var $ = layui.$;
            var layer = layui.layer;
            //监听提交
            form.on('submit(formDemo)', function (data) {

                $.post("/Module/Add1", data.field, function (res) {
                    if (res.Success) {
                        var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                        parent.layer.close(index); //再执行关闭
                        window.parent.location.reload();
                        layer.msg(res.Message)
                    } else {
                        layer.msg(res.Message)
                    }

                })
                return false;
            });
        });
    </script>
</body>
</html>
